package com.krmes.mes.ui.dialog;

import android.app.Activity;
import android.content.Context;

import com.krmes.mes.R;

public class DialogHelper {
    public static CommonDialog getPinterestDialog(Context context) {
        return new CommonDialog(context, R.style.dialog_common);
    }

    public static CommonDialog getPinterestDialogCancelable(Context context) {
        CommonDialog dialog = new CommonDialog(context, R.style.dialog_common);
        dialog.setCanceledOnTouchOutside(true);
        return dialog;
    }

    public static WaitDialog getWaitDialog(Activity activity, int message) {
        Exception e;
        WaitDialog dialog = null;
        try {
            WaitDialog dialog2 = new WaitDialog(activity, R.style.dialog_waiting);
            try {
                dialog2.setMessage(message);
                return dialog2;
            } catch (Exception e2) {
                e = e2;
                dialog = dialog2;
                e.printStackTrace();
                return dialog;
            }
        } catch (Exception e3) {
            e = e3;
            e.printStackTrace();
            return dialog;
        }
    }

    public static WaitDialog getWaitDialog(Activity activity, String message) {
        WaitDialog dialog = null;
        try {
            dialog = new WaitDialog(activity, R.style.dialog_waiting);
            dialog.setMessage(message);
        }catch (Exception ex){
            ex.printStackTrace();
        }
        return dialog;
    }

    public static WaitDialog getCancelableWaitDialog(Activity activity, String message) {
        Exception ex;
        WaitDialog dialog = null;
        try {
            WaitDialog dialog2 = new WaitDialog(activity, R.style.dialog_waiting);
            try {
                dialog2.setMessage(message);
                dialog2.setCancelable(true);
                return dialog2;
            } catch (Exception e) {
                ex = e;
                dialog = dialog2;
                ex.printStackTrace();
                return dialog;
            }
        } catch (Exception e2) {
            ex = e2;
            ex.printStackTrace();
            return dialog;
        }
    }
}
